import { useState, useEffect, createContext, useContext } from 'react'
import React from 'react';
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'

import './App.css'
import Card from './components/Card/index'
import { ConfigContext } from 'antd/es/config-provider';
const MyContext = createContext(null)

function App() {
  const [count, setCount] = useState(0)
  useEffect(() => {
    console.log('执行了', count);
  })
  const setCou = (() => {
    setCount((count) => count + 1)
  })
  // return (
  //   <MyContext.Provider value={'哈哈哈哈我是注入的'}>
  //     <Card count="123543645765"></Card>

  //   </MyContext.Provider>

  // )
  return (
    <MyContext.Provider value={'我是注入的'}>
      <div>
        <Card name={MyContext}></Card>
        <Bpp></Bpp>
      </div>
    </MyContext.Provider>
  )
}
function Bpp() {
  const provider = useContext(MyContext)
  return (
    <div>
      <h1>我是Bpp</h1>
      <p>我是从MyContext中获取的：{provider}</p>
    </div>
  )
}
export default App
